﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace ShapeDrawer
{
    public class Icon : IconControl
    {
        public Icon(string normalIconSource, string hoverIconSource)
            : base(normalIconSource, hoverIconSource)
        {
            this.Frame.MouseEnter += Icon_MouseEnter;
            this.Frame.MouseLeave += Icon_MouseLeave;
            this.Frame.MouseLeftButtonUp += Icon_MouseLeftButtonUp;
        }

        private void Icon_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (this.State == State.Normal)
            {
                this.State = State.Hover;
            }
        }

        private void Icon_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (this.State == State.Hover)
            {
                this.State = State.Normal;
            }
        }

        private void Icon_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            this.ClickedOn();
        }
    }
}
